package gameos.game.main;

import gameos.core.Asset;
import gameos.core.GameOS;
import gameos.core.IScreen;
import gameos.game.IEntityGame;

public class Score extends IEntityGame{

	public int score = 0;
	public int money = 0;
	public int hp = 4;
	public int move;
	public int kill;
	public int killRank;
	
	public void reset()
	{
		score = 0;
		money = game.dataSave.money;
		hp = 4;
		move = 0;
		kill = 0;
		killRank = 0;
	}
	
	public Score (GameOS game, IScreen screen) {
		super(game, screen);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void start () {
		// TODO Auto-generated method stub
	}

	@Override
	public void stop () {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void draw () {
		// TODO Auto-generated method stub
		int hp = this.hp;
		if(hp<0)
			hp = 0;
		if(hp>4)
			hp=4;
		game.batcher.draw(Asset.HP[hp].region, game.X(20), game.Y(490)-Asset.HP[hp].hi, Asset.HP[hp].wi, Asset.HP[hp].hi);
		game.batcher.draw(Asset.score.region, game.X(20+143+20), game.Y(490)-Asset.score.hi, Asset.score.wi, Asset.score.hi);		
		game.batcher.draw(Asset.money.region, game.X(20+143+20+300+20), game.Y(490)-Asset.money.hi, Asset.money.wi, Asset.money.hi);
		game.freeFontTypeTool.normalFont.draw(game.batcher, ""+score, game.X(20+143+20+10)+Asset.score.wi, game.Y(490-10));
		game.freeFontTypeTool.normalFont.draw(game.batcher, ""+money, game.X(20+143+20+300+20)+Asset.money.wi, game.Y(490-10));
	}

	@Override
	public void update (int delayTime) {
		// TODO Auto-generated method stub
		
	}

	public void addScore(int x)
	{		
		score+=x;
		money+=x;
		kill ++;
		killRank++;
	}
	
	public void subHP()
	{
		if(_screen.nvc.isBattu == false){
			hp --;
			_screen.hit.restart();
			_screen.nvc.nhapnhay();
			game.vibrate(500);
			if (killRank < 20) {
			} else if (killRank < 30) {
			} else if (killRank < 50) {
				killRank = 30;
			} else if (killRank < 70) {
				killRank=50;
			} else if (killRank < 90) {
				killRank = 70;
			} else {
				killRank = 90;
			}
		}
	}
	
	public void saveData()
	{		
	}
	
	public void saveHiScore()
	{		
	}
	
	public String achivementHighscore(final int score) {
		if (score < 4000) {
			return "novice";
		} else if (score < 7000) {
			return "skillfull";
		} else if (score < 15000) {
			return "expert";
		} else if (score < 25000) {
			return "unstoppedable";
		} else {
			return "master";
		}
	}
	
	public int achivementPlaying(final int count) {
		if (count < 20) {
			return 0;
		} else if (count < 30) {
			return 1;
		} else if (count < 50) {
			return 2;
		} else if (count < 70) {
			return 3;
		} else if (count < 90) {
			return 4;
		} else {
			return 5;
		}
	}
}
